//
//  ZCMyMusicTableVC.m
//  SSMusic
//
//  Created by 张灿 on 16/4/18.
//  Copyright © 2016年 张灿. All rights reserved.
//

#import "ZCMyMusicTableVC.h"

@interface ZCMyMusicTableVC ()

//cell的标题数组
@property (nonatomic, strong) NSArray *nameArr;

//cell的图片数组
@property (nonatomic, strong) NSArray *imageArr;

@end

@implementation ZCMyMusicTableVC

static NSString * const ID = @"cell";

- (void)viewDidAppear:(BOOL)animated
{
    
    [super viewDidAppear:animated];
    
    //左侧"更多"
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"更多" style:0 target:self action:@selector(more)];
    //设置字体显示白色
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    dict[NSForegroundColorAttributeName] = [UIColor whiteColor];
    [self.navigationItem.leftBarButtonItem setTitleTextAttributes:dict forState:UIControlStateNormal];
 
}

//更多
- (void)more
{
    NSLog(@"更多");
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //标题添加到数组
    self.nameArr = @[@"下载音乐", @"最近播放", @"我的歌手"];
    
    //图片添加到数组
    self.imageArr = @[@"cm2_list_icn_dld_new", @"cm2_list_icn_recent_new", @"cm2_list_icn_artists_new"];
    
    
    //tableview底部遮挡
    self.tableView.tableFooterView = [[UIView alloc] init];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.nameArr.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    
    //设置cell右侧有没有小箭头
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    //图片
    cell.imageView.image = [UIImage imageNamed:_imageArr[indexPath.row]];
    //标题
    cell.textLabel.text = _nameArr[indexPath.row];
    //选中cell时的样式
    cell.selectionStyle = UITableViewCellSelectionStyleGray;
    
    
    
    return cell;
}


@end
